REPLICATION FILES FOR: "The 2019 Chilean Social Upheaval: A Descriptive Approach"
Loreto Cox, Ricardo González, and Carmen Le Foulon


Appendix.pdf is the paper's online appendix.

GENERAL

1. In you working directory, yoy need to create two subfolders that are called in the code: "tables" and "folders".
2. We recommend to create a folder to download the material and set it as your working directory.  

CODE FILES 
1. "repfiles_dataset.do": Stata Do file: generates the variables used in the regression and figures, generates a new dataset "cep84.dta" which is called both in the "repfiles_tables.do" and "01_replication_figures.rmd".
2. "coding_resp.do": code not needed to replicate results. Explanation: two variables analyzed in the paper on attribution to police or armed forces of responsability in looting and arson are constructed from answers from the open ended alternative "Other". By protocol, CEP does not make public these open ended answers, since it requires a confidentialtiy agreement from user.  Hence, those interested must first contact Centro de Estudios Públicos coordinator (encuestas@cepchile.cl) and formally request those variables in the dataset. Once requested, this do file generates the variables used in the paper and saves a new dataset "cep84_resp.dta", which is included in the replication files (see DATA BASES).
3. "repfiles_tables.do": Stata Do file: requires "cep84.dta" and "cep84_resp.dta": code runs the regressions and generates and saves .csv files with the regression results in the subfolder "tables".  Additional formatting is required to recreate the tables in the Appendix. 
4. "01_replication_figures.rmd": R script: using "cep84.dta", generates and saves the figures in pdf format in the subfolder "figures"


DATA BASES
1. "Encuesta CEP 84 Dic 2019 v1.sav" : original database, Centro de Estudios Publicos, December 2019, available at https://www.cepchile.cl/encuesta/estudio-nacional-de-opinion-publica-n84-diciembre-2019-2/
2. "cep84.dta" :  database created from the original dataset using "repfiles_dataset.do". Included for convencience in the replication files.
3. "cep84_resp.dta" : as explained in "CODE FILES", variables on attribution to police or armed forces of responsability in looting and arson are not publicly available (but may be requested to CEP). Therefore, it is not possible to create them from the publicly available database nor it is possible for us to share it publicly. Hence, we include this dataset that contains only the coded variable as well as the key variables to reproduce the tables and figures.
 

SURVEY USER'S GUIDE
1.Survey user's guide.pdf : Includes methodology, questionnaire, and codebook (original, in Spanish)


Software versions:
1. Stata 14
2. R version 4.3.1
3. RStudio 2023.06.2+561
4. R packages: tidyverse 2.0.0; srvyr 1.2.0; questionr 0.7.8; haven 2.5.3     

